<?php
/* 
-----------------------------------------------------------------
Copyright (c) 2010 25Solutions   All Rights Reserved.

This software is the confidential and proprietary information
of 25Solutions ("Confidential Information").
You shall not disclose such Confidential Information and shall
use it only in accordance with the terms of the license
agreement you entered into with 25Solutions
-----------------------------------------------------------------
 */

/**
 * Loads the test fixtures
 */
require_once dirname(__FILE__).'/../bootstrap/Doctrine.php';


//per vedere il coverage
//symfony test:coverage --detailed test/unit lib/model

//The Swift_Mailer has to be loaded before instantiating a TfMailsMessage class
$mailer = ProjectConfiguration::getMailer();

$t = new lime_test(2);


$t->comment('TfMailsMessage __construct');
$campaign = Doctrine_Core::getTable('Campaign')->findOneByName('Campagna marketing 1');

//$template = Doctrine_Core::getTable('Template')->findOneByName('Subscription');
$template = $campaign->getTemplate();
$recipient = Doctrine::getTable('Recipient')->findOneByUsername('fabioarcadja');
$message = new TfMailsMessage($template, $recipient, $campaign->getCampaignId());
//1
$t->is($message->getTo(), array('fabio.lorenzini@arcadja.it' => 'Arcadja s.r.l.') , 'verifyng recipient');
//2
$t->is($message->getSubject(), 'March Promotion' , 'verifyng subject');


